package lokal.giffey;

import java.util.regex.Pattern;

public class Kreditkarte {
	String nr;
	
	public Kreditkarte(String nummer) {
		try {
			setNr(nummer);
		} catch (Exception e) {
			System.out.println(e.getMessage());
		}
	}
	
	public String getNr() {
		return nr;
	}
	
	public void setNr(String nummer) throws Exception {
		if(Pattern.matches("[0-9]*", nummer))
			this.nr = nummer;
		else
			throw new Exception("NumericError");
			
	}
	@Override
	public String toString(){
		return getNr();
	}
	
}
